package com.bonc.situation.config;

import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.bonc.situation.job.DataSyncJob;


/** 
* @Author guxf
* @Time 2020年12月25日 下午8:25:39 
* @Version 1.0
* <p>Description:</p>
*/
@Configuration
public class QuartzConfig {
	@Bean
	public JobDetail weatherDataSyncJobJobDetail(){
		return JobBuilder.newJob(DataSyncJob.class)
				.withIdentity("dataSyncJob").storeDurably().build();

	}
	@Bean
	public Trigger sampleJobTrigger(){
		SimpleScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(60*30).repeatForever();
		return TriggerBuilder.newTrigger().forJob(weatherDataSyncJobJobDetail()).withIdentity("dataSyncTrigger").withSchedule(scheduleBuilder).build();
	}
}
